import { DependencyContainer, Response, useRedis } from "@sker/core"
import { useData } from "@sker/runtime"
import { z } from "zod"

export default async (injector: DependencyContainer) => {
    const input = z.object({
        name: z.string()
    })
    const body = input.parse(useData())
    const res = injector.resolve(Response)
    await useRedis(8, async r => {
        const content = await r.hGet('bugs', body.name)
        if(content){
            res.type('html')
            res.end(content)
        }
    });
}
